<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var BMI={};
       BMI.getBMI=function(a,b){
          var bmi=b/((a/100)*(a/100));
          return bmi;
        };
        BMI.idealweight=function(a){
          var x=(a-100)*0.9;
          return x;
        };
        function Cal(form){
          var a=eval(form.height.value);
          var b=eval(form.weight.value);
          var bmiValue =BMI.getBMI(a,b);
          BMI.disp_alert(bmiValue );
        }
        BMI.disp_alert = function(bmi){
          if (bmi < 18.5)
          {
            alert("您的体质为偏瘦");
          }
          else if (bmi >= 18.5 && bmi < 24)
          {
            alert("您的体质为正常");
          }
          else if (bmi >= 24 && bmi< 28)
          {
            alert("您的体质为偏胖");
          }
          else if (bmi >= 28 && bmi< 30)
          {
            alert("您的体质为肥胖");
          }
          else if (bmi >= 30 && bmi< 40)
          {
            alert("您的体质为重度肥胖");
          }
          else
          {
            alert("您的体质为极重度肥胖");
          }
        }
      </script>
      </head>
      <body>
      <form method=post>
      你的身高(cm):<input type="text" name="height"><br>
        <br/>
      你的体重(kg):<input type="text" name="weight"><br>
        <br/>
      <input type="button" value="开始计算" onclick="Cal(this.form)">
        <br/>
        <br/>
        <br/>
</body>
</html>